home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / uucp / dialers.c < prev    next >
C/C++ Source or Header  |  1996-03-26  |  2KB  |  81 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "../misc/misc.h"
  4. #include "internal.h"
  5. #include "uucp.h"
  6. #include "uucp.m"
  7. #include "../paths.h"
  8.  
  9. static UUCP_HELP_FILE help_dialers("dialers");
  10. static CONFIG_FILE f_dialers (VAR_LIB_UUCP_DIALERS
  11.     ,help_dialers
  12.     ,CONFIGF_OPTIONNAL|CONFIGF_MANAGED
  13.     ,"uucp","uucp",0660);
  14.  
  15.  
  16. PUBLIC DIALER::DIALER ()
  17. {
  18. }
  19.  
  20. PUBLIC DIALER::DIALER (
  21.     const char *buf,    // Buffer to parse from the Permissions file
  22.     const SSTRING &_comments,    // Comments preceding the definition
  23.     char *err)            // Will contain error message or '\0'
  24. {
  25.     comments.setfrom (_comments);
  26.     comments.strip_end();
  27.     err[0] = '\0';
  28.     buf = type.copyword (buf);
  29.     buf = phonecnv.copyword (buf);
  30.     buf = str_skip (buf);
  31.     chat.setfrom (buf);
  32. }
  33.  
  34. /*
  35.     Write one record in the Permissions file
  36. */
  37. PUBLIC void DIALER::write (FILE *fout)
  38. {
  39.     comment_write (comments,fout);
  40.     fprintf (fout,"%s\t%s\t%s\n",type.get(),phonecnv.get(),chat.get());
  41. }
  42.  
  43. PUBLIC DIALERS::DIALERS()
  44.     : CONFIG_OBJS (f_dialers)
  45. {
  46. }
  47.  
  48. PUBLIC DIALER *DIALERS::getitem(int no) const
  49. {
  50.     return (DIALER*)ARRAY::getitem(no);
  51. }
  52.  
  53. /*
  54.     Get a dialer description from its name (type)
  55. */
  56. PUBLIC DIALER *DIALERS::getitem(const char *type) const
  57. {
  58.     DIALER *ret = NULL;
  59.     int n = getnb();
  60.     for (int i=0; i<n; i++){
  61.         DIALER *d = getitem(i);
  62.         if (d->type.cmp(type)==0){
  63.             ret = d;
  64.             break;
  65.         }
  66.     }
  67.     return ret;
  68. }
  69.  
  70. PROTECTED CONFIG_OBJ *DIALERS::newobj (
  71.     const char *buf,    // Buffer to parse from the Permissions file
  72.     const SSTRING &_comments,    // Comments preceding the definition
  73.     char *err)            // Will contain error message or '\0'
  74. {
  75.     return new DIALER (buf,_comments,err);
  76. }
  77.  
  78.  
  79.  
  80.  
  81.